<?php
	session_start();
	mysql_connect("localhost", "sapmenet_admin", "a1s2d3f4g5h6j7") or die ("Problem with datebase");
	mysql_select_db("sapmenet_users");
	echo($_POST['idfr']);
	mysql_query ("UPDATE friendships SET confirmed=1 WHERE id={$_POST['idfr']}");
	if ($_SESSION['id']!=$_SESSION['JID'])
	{
		$name=mysql_query("SELECT concat (FirstName, ' ', LastName) AS fullName FROM users WHERE id={$_SESSION['JID']}");
		$name=mysql_result($name,0);
		$text="<a href=http://sapme.net/Framework/profilePage.php?id=".$_POST['idfr'].">".$name." confirmed your friendship!</a>";
		mysql_query("INSERT INTO notifications (text, userID) VALUES ('".$text."', {$_SESSION['id']})");
	}
?>